package com.example.crm.servlet;

import com.example.crm.service.ICustomerService;
import com.example.crm.service.impl.CustomerServicelmpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/customer/remove")
public class CustomerRemoveServlet extends HttpServlet {

    ICustomerService customerService = new CustomerServicelmpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

         String customerid=req.getParameter("id");
         int id=Integer.parseInt(customerid);
         customerService.del(id);
//         resp.sendRedirect("/customer");
        req.getRequestDispatcher("/customer").forward(req,resp);
    }
}
